package cn.lg.soar.database.handler.type.sm4;

import cn.lg.soar.common.util.data.DataUtil;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;

/**
 * long数据对称加密处理
 * @author luguoxiang
 * @date 2022-05-20
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@MappedJdbcTypes(JdbcType.VARCHAR)
@MappedTypes(Long.class)
public class LongSm4Handler extends AbstractSm4Handler<Long> {

    @Override
    protected Long ofBytes(byte[] bytes) {
        return DataUtil.byteToLong(bytes);
    }

    @Override
    protected byte[] toBytes(Long value) {
        return DataUtil.longToBytes(value);
    }

}
